﻿// if和switch//

#if 0
#define _CRT_SECURE_NO_WARNINGS                     if语句
#include <stdio.h>
int main()
{
    int a, b, c, min = 0;
    scanf("%d%d%d", &a, &b, &c);
    if (a > b)
        min = b;
    else
        min = a;
    if (min > c)
        min = c;
    printf("%d", min);
    return 0;
};
#endif // 0

#if 0
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>                           //输入两个数，把小的赋给X，把大的赋给Y//
int main()
{
    int x = 0, y=0, t = 0;
    scanf("%d %d",&x,&y);
    if (x>y)
    {
        t = x;
        x = y;
        y = t;
    }
    printf("x=%d,y=%d",x, y);
    return 0;
}
#endif // 0

#if 0
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>                                           //成绩和对应的等级//
int main()
{
    int score = 0;
    int grade = 0;
    scanf("%d", &score);
    if (score >= 90 && score <= 100)
        grade = 'A';
    else if (score >= 80 && score <= 89)
        grade = 'B';
    else if (score >= 70 && score <= 79)
        grade = 'C';
    else if (score >= 0 && score <= 69)
        grade = 'D';
    else
        printf("你输入的成绩是错误的\n");
    printf("score=%d,grade=%c", score, grade);
    return 0;
}
#endif // 0

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>                                     //输入月份，打印出2022年对应的月份有几天//
int main()
{
    int month = 0;
    int day = 0;
    printf("please input the month number:\n");
    scanf("%d", &month);
    switch (month)
    {
    default:day = -1;
    case1:
    case3:
    case5:
    case7:
    case8:
    case10:
    case12:day=31;
        break;
    case4:
    case6:
    case9:
    case11:day = 30;
        break;
    case2:day = 28;
        break;
    }
    if (day == -1)
    {
        printf("请输入正确的天数\n");
    }
    else
        printf("2022.%d月有%d天", month, day);
    return 0;
}